package javax.realtime;

import esrc.c9cf.schedulers.PartitionedPriorityScheduler;

public class PriorityParameters extends SchedulingParameters implements Cloneable {

	private int priority;
	private Scheduler scheduler;
	
	public PriorityParameters(int priority)
	{
		this(priority, null);
	}
	public PriorityParameters(int priority, Scheduler scheduler)
	{
		this.scheduler = scheduler;
		setPriority(priority);
	}
	
	public int getPriority()
	{
		return priority;
	}
	public void setPriority(int priority)
	{
		if(scheduler != null)
		{
			if(scheduler instanceof PriorityScheduler)
			{
				if((priority < ((PriorityScheduler) scheduler).getMinPriority()) || priority > ((PriorityScheduler)scheduler).getMaxPriority()) throw new IllegalArgumentException();
			}
		}
		this.priority = priority;
	}
	public String toString()
	{
		return Integer.toString(priority);
	}
	
	public Scheduler getScheduler()
	{
		return scheduler;
	}
	public void setScheduler(Scheduler scheduler)
	{
		this.scheduler = scheduler;
	}
}
